import axios from 'axios'

export default class RequestCancel {
  get token() {
    if (!this._source) this._source = axios.CancelToken.source()
    return this._source.token
  }

  cancel(msg) {
    if (this._source) {
      this._source.cancel(msg)
      this._source = null
    }
  }
}
